//goback
var isdebug = 1;

var goback = function(rui) {
	if (rui != '') {
		window.location.href = rui;
	} else {
		history.go(-1);
	}
}

//ajax
var scpost = function(url, data) {
	var myres;
	$.ajax({
		url: url,
		data: data,
		type: "post",
		dataType: 'json',
		async: false,
		success: function(res) {
			myres = res;
		},
		error: function(error) {}
	})
	return myres;
}

//date
// 调用方法
// var time = new Date().Format("yyyy-MM-dd");
Date.prototype.Format = function(fmt) { //author: meizz 
	var o = {
		"M+": this.getMonth() + 1, //月份 
		"d+": this.getDate(), //日 
		"H+": this.getHours(), //小时 
		"m+": this.getMinutes(), //分 
		"s+": this.getSeconds(), //秒 
		"q+": Math.floor((this.getMonth() + 3) / 3), //季度 
		"S": this.getMilliseconds() //毫秒 
	};
	if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
	for (var k in o)
		if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[
			k]).substr(("" + o[k]).length)));
	return fmt;
}

//日期加减
// var now = new Date();
// 加五天.
// var newDate = DateAdd("d ", 5, now);
// 加两个月.
// newDate = DateAdd("m ", 2, now);
// 加一年
// newDate = DateAdd("y ", 1, now);
var DateAdd = function(interval, number, date) {
	switch (interval) {
		case "y":
			{
				date.setFullYear(date.getFullYear() + number);
				return date;
				break;
			}
		case "q":
			{
				date.setMonth(date.getMonth() + number * 3);
				return date;
				break;
			}
		case "m":
			{
				date.setMonth(date.getMonth() + number);
				return date;
				break;
			}
		case "w":
			{
				date.setDate(date.getDate() + number * 7);
				return date;
				break;
			}
		case "d":
			{
				date.setDate(date.getDate() + number);
				return date;
				break;
			}
		case "h":
			{
				date.setHours(date.getHours() + number);
				return date;
				break;
			}
		case "m":
			{
				date.setMinutes(date.getMinutes() + number);
				return date;
				break;
			}
		case "s":
			{
				date.setSeconds(date.getSeconds() + number);
				return date;
				break;
			}
		default:
			{
				date.setDate(d.getDate() + number);
				return date;
				break;
			}
	}
}

//获取屏幕高度
var winHeight = function() {
	return window.screen.height
}
// window.onload = function() {
// 	var membercode = $.cookie('sc_fenxiao_membercode'); //获取cookie
// 	if ( isdebug != 1) {
// 		if (membercode == null || membercode == "undefined" || membercode == "") {
// 			window.location.href = "/page/passport/login.html";
// 		}
// 	}
// };
